Skip to content

Conversation

@ChristopherRyan-GM
Copy link

Handle LINKAGE SECTION and PROCEDURE DIVISION USING; skip ENTRY statements

Summary

This change updates the cobolcheck Generator to properly handle COBOL programs that declare a LINKAGE SECTION, use a multi-line PROCEDURE DIVISION USING clause, and include ENTRY statements (e.g., DLITCBL) that reference LINKAGE variables. It also adds a focused test program and test cases to validate behavior.


Changes

  • Introduce state to track multi-line clauses in Generator:

    • skipUsingClauseLines and skipEntryStatementLines.
  • Add processLinkageSectionFix(String sourceLine) to:

    • Skip LINKAGE SECTION line entirely.

    • Normalize PROCEDURE DIVISION USING ... to PROCEDURE DIVISION. while:

      • Preserving sequence area and indentation.
      • Skipping subsequent USING lines until the terminating period for multi-line clauses.
    • Detect and skip ENTRY statements that reference LINKAGE variables (single- and multi-line), resuming after the terminating period.

  • Route lines through the new processing step before writing:

    • Replace direct writeLine(sourceLine) with the processed result, writing only when non-null.
  • Add a COBOL sample program to exercise LINKAGE + USING + ENTRY:

    • src/main/cobol/TEST-LINKAGE.CBL (new).
  • Add tests:

    • src/test/cobol/TEST-LINKAGE/TestLinkageSection.cut (new) with two test cases covering main and an additional entry point behavior.

Testing

  • New COBOL program TEST-LINKAGE.CBL exercises LINKAGE, PROCEDURE DIVISION USING, and ENTRY scenarios.

  • New cut tests:

    • Main entry point increments WS-COUNTER to 1 and sets WS-WORK-AREA to "MAIN ENTRY".
    • Secondary entry point increments WS-COUNTER to 10 and sets WS-WORK-AREA to "ENTRY POINT".

These validate that generation proceeds correctly without emitting LINKAGE/USING/ENTRY constructs while preserving program flow for testing.

Srinidh-GM and others added 3 commits November 26, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants